package com.wintop.youyuan.util;

import javax.servlet.http.HttpServletRequest;

public class ActionUtil {
	public static String getBaseUrl(HttpServletRequest request) {
		String baseUrl = request.getScheme() + "://" + request.getServerName()
				+ ":" + request.getServerPort();
		baseUrl += request.getContextPath() + "/";
		return baseUrl;
	}

	public static String getIcon(String userid, String icon) {
		if (icon == null) {
			return "images/system/nohead_new.jpg";
		} else {
			return "images\\userImages\\" + userid + "\\" + icon;
		}
	}

	public static String getSayHello() {
		int n = (int) (Math.random() * 10);
		String Str = null;
		switch (n) {
		case 0:
			Str = "你好，很高兴认识你";
			break;
		case 1:
			Str = "想与你认识一下可以吗?";
			break;
		case 2:
			Str = "请问你有结婚打算吗？";
			break;
		case 3:
			Str = "你想找个什么条件的呢？";
			break;
		case 4:
			Str = "你在什么地方上班？";
			break;
		case 5:
			Str = "你还在吗,可以的话陪我聊聊?";
			break;
		case 6:
			Str = "Hello,你平时总上网聊天么?";
			break;
		case 7:
			Str = "网上找可靠的难啊,你填的都是真的吧？";
			break;
		case 8:
			Str = "老家哪的？现在做什么啊？";
			break;
		case 9:
			Str = "我觉得我们很有缘分,你相信缘分嘛?";
			break;
		default:
			Str = "你好啊，能交个朋友吗？";
			break;
		}
		return Str;
	}

	public static String getApartment(String apartment) {// 获取居住地
		if (apartment == null) {
			return "";
		}
		String apartmentStr = "";
		String[] str = apartment.split("-");
		if (!str[0].equals("省份")) {
			apartmentStr += str[0];
		}
		if (!str[1].equals("地级市")) {
			apartmentStr += " ";
			apartmentStr += str[1];
		}
		return apartmentStr;
	}

	public static String getPersonalApartment(String apartment) {// 获取居住地
		if (apartment == null) {
			return "不限制";
		}
		String apartmentStr = "";
		String[] str = apartment.split("-");
		if (!str[0].equals("不限制")) {
			apartmentStr += str[0];
		}
		if (!str[1].equals("不限制")) {
			apartmentStr += " ";
			apartmentStr += str[1];
		} else {
			if ("".equals(apartmentStr)) {
				apartmentStr += "不限制";
			}
		}
		return apartmentStr;
	}

	public static String getMonthlyIncome(int monthlyIncome) {// 获取月收入
		String monthlyIncomeStr = null;
		switch (monthlyIncome) {
		case 0:
			monthlyIncomeStr = "不限制";
			break;
		case 1:
			monthlyIncomeStr = "小于2000元";
			break;
		case 2:
			monthlyIncomeStr = "2000-5000元";
			break;
		case 3:
			monthlyIncomeStr = "5000-10000元";
			break;
		case 4:
			monthlyIncomeStr = "10000-20000元";
			break;
		case 5:
			monthlyIncomeStr = "20000元以上";
			break;
		}
		return monthlyIncomeStr;
	}

	public static String getSex(int sex) {// 获取性别
		String Str = null;
		switch (sex) {
		case 0:
			Str = "男";
			break;
		case 1:
			Str = "女";
			break;
		}
		return Str;
	}

	public static String getHeight(int height) {// 获取身高
		if (height == 0) {
			return null;
		}
		return height + "cm";
	}

	public static String getWeight(int weight) {// 获取体重
		if (weight == 0) {
			return null;
		}
		return weight + "斤";
	}

	public static String getHouse(int house) {// 获取是否买房
		String Str = null;
		switch (house) {
		case 0:
			Str = "未填写";
			break;
		case 1:
			Str = "已购房";
			break;
		case 2:
			Str = "与父母同住";
			break;
		case 3:
			Str = "租房";
			break;
		case 4:
			Str = "其它";
			break;
		}
		return Str;
	}

	public static String getEducation(int education) {// 学历
		String educationStr = null;
		switch (education) {
		case 0:
			educationStr = "不限制";
			break;
		case 1:
			educationStr = "初中及以下学历";
			break;
		case 2:
			educationStr = "高中及中专";
			break;
		case 3:
			educationStr = "大专";
			break;
		case 4:
			educationStr = "本科";
			break;
		case 5:
			educationStr = "硕士及以上";
			break;
		}
		return educationStr;
	}

	public static String getLoveType(int loveType) {// 获取喜欢的类型
		String loveTypeStr = null;
		switch (loveType) {
		case 0:
			loveTypeStr = "未填写";
			break;
		case 1:
			loveTypeStr = "成熟魅力";
			break;
		case 2:
			loveTypeStr = "落落大方";
			break;
		case 3:
			loveTypeStr = "眉清目秀";
			break;
		case 4:
			loveTypeStr = "性感妩媚";
			break;
		case 5:
			loveTypeStr = "善解人意";
			break;
		case 6:
			loveTypeStr = "雍容华贵";
			break;
		case 7:
			loveTypeStr = "活泼开朗";
			break;
		case 8:
			loveTypeStr = "娇小可爱";
			break;
		case 9:
			loveTypeStr = "温柔体贴";
			break;
		}
		return loveTypeStr;
	}

	public static String getPremaritalSex(int premaritalSex) {// 获取是否接受婚前性行为
		String premaritalSexStr = null;
		switch (premaritalSex) {
		case 0:
			premaritalSexStr = "未填写";
			break;
		case 1:
			premaritalSexStr = "能";
			break;
		case 2:
			premaritalSexStr = "看情况";
			break;
		case 3:
			premaritalSexStr = "不能";
			break;
		}
		return premaritalSexStr;
	}

	public static String getMarryCondition(int marryCondition) {// 获取婚姻状况
		String marryConditionStr = null;
		switch (marryCondition) {
		case 0:
			marryConditionStr = "未填写";
			break;
		case 1:
			marryConditionStr = "未婚";
			break;
		case 2:
			marryConditionStr = "离异";
			break;
		case 3:
			marryConditionStr = "丧偶";
			break;
		}
		return marryConditionStr;
	}

	public static String getLiveWithParents(int liveWithParents) {// 获取是否与父母同住
		String liveWithParentsStr = null;
		switch (liveWithParents) {
		case 0:
			liveWithParentsStr = "未填写";
			break;
		case 1:
			liveWithParentsStr = "愿意";
			break;
		case 2:
			liveWithParentsStr = "看情况";
			break;
		case 3:
			liveWithParentsStr = "不愿意";
			break;
		}
		return liveWithParentsStr;
	}

	public static String getProfession(int profession) {// 获取职业
		String professionStr = null;
		switch (profession) {
		case 0:
			professionStr = "未填写";
			break;
		case 1:
			professionStr = "在校学生";
			break;
		case 2:
			professionStr = "军人";
			break;
		case 3:
			professionStr = "私营业主";
			break;
		case 4:
			professionStr = "企业职工";
			break;
		case 5:
			professionStr = "农业劳动者";
			break;
		case 6:
			professionStr = "政府机关/事业单位工作者";
			break;
		case 7:
			professionStr = "其他";
			break;
		}
		return professionStr;
	}

	public static String getChildren(int children) {// 获取是否要小孩
		String childrenStr = null;
		switch (children) {
		case 0:
			childrenStr = "未填写";
			break;
		case 1:
			childrenStr = "想";
			break;
		case 2:
			childrenStr = "不想";
			break;
		case 3:
			childrenStr = "还没想好";
			break;
		}
		return childrenStr;
	}

	public static String getDistanceLove(int distanceLove) {// 获取是否能接收异地恋
		String distanceLoveStr = null;
		switch (distanceLove) {
		case 0:
			distanceLoveStr = "未填写";
			break;
		case 1:
			distanceLoveStr = "能";
			break;
		case 2:
			distanceLoveStr = "看情况";
			break;
		case 3:
			distanceLoveStr = "不能";
			break;
		}
		return distanceLoveStr;
	}

	public static String getCharm(int charm) {// 获取魅力部位
		String charmStr = null;
		switch (charm) {
		case 1:
			charmStr = "笑容";
			break;
		case 2:
			charmStr = "眉毛";
			break;
		case 3:
			charmStr = "眼睛";
			break;
		case 4:
			charmStr = "头发";
			break;
		case 5:
			charmStr = "鼻梁";
			break;
		case 6:
			charmStr = "嘴唇";
			break;
		case 7:
			charmStr = "牙齿";
			break;
		case 8:
			charmStr = "颈部";
			break;
		case 9:
			charmStr = "耳朵";
			break;
		case 10:
			charmStr = "手";
			break;
		case 11:
			charmStr = "胳膊";
			break;
		case 12:
			charmStr = "胸部";
			break;
		case 13:
			charmStr = "腰部";
			break;
		case 14:
			charmStr = "脚";
			break;
		case 15:
			charmStr = "腿";
			break;
		case 16:
			charmStr = "臀部";
			break;
		}
		return charmStr;
	}

}
